import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from './axios.js'
import App from './App.vue'
import router from './router'
import store from './store/index'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import './assets/styles/reset.css'
import './assets/styles/common.css'
import './plugins/element.js'
import './plugins/vcharts.js'
import 'swiper/dist/css/swiper.css'
import '@/assets/icons/iconfont.css'
import './plugins/directives.js';

import ZycmTable from './components/templateTable/ZycmTable'
import ZycmTree from './components/templateTable/ZycmTree'
import Invoking from "@/api/Invoking.js";
import zycmUtils from "@/api/zycmUtils.js";
import GlobalVar from "@/api/GlobalVariable.js";

Vue.use(ElementUI);
Vue.use(VueAwesomeSwiper)
Vue.component('zycm-table', ZycmTable)
Vue.component('zycm-tree', ZycmTree)
Vue.prototype.Invoking = Invoking
Vue.prototype.zycmUtils = zycmUtils
Vue.prototype.GlobalVar = GlobalVar

// 过滤器
Vue.filter('dateFormat', function(originVal) {
    if (originVal == null || originVal == "" || originVal == undefined) {
        return "";
    }
    const dt = new Date(originVal)
    const y = dt.getFullYear()
    const m = (dt.getMonth() + 1 + '').padStart(2, '0')
    const d = (dt.getDate() + '').padStart(2, '0')
    const hh = (dt.getHours() + '').padStart(2, '0')
    const mm = (dt.getMinutes() + '').padStart(2, '0')
    const ss = (dt.getSeconds() + '').padStart(2, '0')
    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

Vue.filter('convertBytes', function(originVal) {
    return zycmUtils.convertBytes(originVal * 1);
})
Vue.filter('convertSecond', function(originVal) {
    return zycmUtils.convertSecond(originVal);
})


new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')